import java.util.*;

public class _2023_10_25 {
    private static void flush(int[] arr){
        int l = 0;
        int r = arr.length / 2;
        int[] tmpArr = new int[arr.length];
        int i = 0;
        for(; l < arr.length / 2; l++,r++){
            tmpArr[i++] = arr[l];
            tmpArr[i++] = arr[r];
        }
        for(i = 0; i < arr.length; i++){
            arr[i] = tmpArr[i];
        }
    }

    public static void main1(String[] args) {
        Scanner sc = new Scanner(System.in);
        int t = sc.nextInt();
        while(t-- > 0){
            int n = sc.nextInt();
            int k  =sc.nextInt();
            int[] arr = new int[2 * n];
            for(int i = 0; i < 2 * n; i++){
                arr[i] = sc.nextInt();
            }
            for(int i = 0; i < k; i++){
                flush(arr);
            }
            for(int e : arr){
                System.out.print(e + " ");
            }
            System.out.println();
        }
    }


    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String ss = sc.next();
        char[] s = ss.toCharArray();
        int index = 1;
        int[] win = new int[]{1,2,3,4};
        for(int i = 0; i < s.length; i++){
            if(s[i] == 'U'){
                if(index == 1 && win[0] == 1){
                    index = 4;
                    for(int j = 0; j < 4; j++){
                        win[j] = n - 4 + 1 + j;
                    }
                }else{
                    if(index == 1){
                        for(int j = 0; j < 4; j++){
                            win[j]--;
                        }
                    }else{
                        index--;
                    }
                }

            }else{
                if((index == 4) && (win[win.length - 1] == n)){
                    index = 1;
                    for(int j = 0; j < 4; j++){
                        win[j] = j + 1;
                    }
                }else{
                    if(index == 4){
                        for(int j = 0; j < 4; j++){
                            win[j]++;
                        }
                    }else{
                        index++;
                    }
                }
            }
        }
        for(int e : win){
            System.out.print(e + " ");
        }
        System.out.println();
        System.out.println(win[index - 1]);
    }
}
